#include "Notification.h"

#include "Framework/Editor.h"

#include "EditorNotificationModel.h"
#include "EditorNotificationViewModel.h"
#include "EditorNotificationView.h"

#include "EditorNotificationItemModel.h"
#include "EditorNotificationItemViewModel.h"
#include "EditorNotificationItemView.h"

#include "Notification/SimpleMessage/EditorSimpleMessageNotificationItemModel.h"
#include "Notification/SimpleMessage/EditorSimpleMessageNotificationItemViewModel.h"
#include "Notification/SimpleMessage/EditorSimpleMessageNotificationItemView.h"

#include "Window/EditorMainWindowModel.h"
#include "Window/EditorWindowGroupModel.h"

void WHE::RegisterNotificationMVVM()
{
    //注册所有的状态栏的MVVM关系
    auto Editor=REditor::Get();

    Editor->RegisterMVVM(
        REditorNotificationModel::StaticClass()
        , REditorNotificationViewModel::StaticClass()
        , REditorNotificationView::StaticClass());

    Editor->RegisterMVVM(
        REditorNotificationItemModel::StaticClass()
        , REditorNotificationItemViewModel::StaticClass()
        , REditorNotificationItemView::StaticClass());

    Editor->RegisterMVVM(
        REditorSimpleMessageNotificationItemModel::StaticClass()
        , REditorSimpleMessageNotificationItemViewModel::StaticClass()
        , REditorSimpleMessageNotificationItemView::StaticClass());

}

void AddSimpleMessageNotification(const CString &InMessage, REditorSimpleMessageNotificationItemModel::EType InType)
{
    auto MessageNotify=NewObject<REditorSimpleMessageNotificationItemModel>();
    MessageNotify->Type=InType;
    MessageNotify->Message=InMessage;

    REditorWindowGroupModel::Get()->MainWindow->GetNotification()
        ->AddItem(MessageNotify);
}

void WHE::AddInfoNotification(const CString &InMessage)
{
    AddSimpleMessageNotification(InMessage, REditorSimpleMessageNotificationItemModel::EType::Info);
}

void WHE::AddWanringNotification(const CString &InMessage)
{
    AddSimpleMessageNotification(InMessage, REditorSimpleMessageNotificationItemModel::EType::Warning);
}

void WHE::AddErrorNotification(const CString &InMessage)
{
    AddSimpleMessageNotification(InMessage, REditorSimpleMessageNotificationItemModel::EType::Error);
}
